package com.example.hotelrear.controller;

import com.example.hotelrear.entity.ResponseResult;
import com.example.hotelrear.entity.Store;
import com.example.hotelrear.service.StoreService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author FengXiao
 * @since 2023-08-28
 */
@RestController
@RequestMapping("/store")
public class StoreController {
    @Resource
    private StoreService storeService;

    @GetMapping("/findstoreName")
    public ResponseResult findstoreName(@Param("storeName") String storeName) {
        Store store = storeService.findstoreName(storeName);
        if (store != null) {
            return ResponseResult.ok(store);
        }else {
            return ResponseResult.fail("没有此门店");
        }
    }
}
